//===============================================================================
// Microsoft patterns & practices
// Guidance Explorer Offline Client
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================


using System;
using System.Windows.Forms;
using GuidanceExplorer.Controls;

namespace GuidanceExplorer.Model
{
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
    public sealed class GuidanceTypeMenuItemAttribute : MenuItemAttribute
    {
        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string commandName, Keys shortCut)
            : base(position, menuItemName, commandName, shortCut)
        {
        }

        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string multipleSelectionName, string commandName, Keys shortCut)
            : base(position, menuItemName, multipleSelectionName, commandName, shortCut)
        {
        }

        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string commandName, Type conditionType, Keys shortCut)
            : base(position, menuItemName, commandName, conditionType, shortCut)
        {
        }

        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string multipleSelectionName, string commandName, Type conditionType, Keys shortCut)
            : base(position, menuItemName, multipleSelectionName, commandName, conditionType, shortCut)
        {
        }

        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string commandName, Type conditionType, Type menuItemsProviderType, Keys shortCut)
            : base(position, menuItemName, commandName, conditionType, menuItemsProviderType, shortCut)
        {
        }

        public GuidanceTypeMenuItemAttribute(int position, string menuItemName, string multipleSelectionName, string commandName, Type conditionType, Type menuItemsProviderType, Keys shortCut)
            : base(position, menuItemName, multipleSelectionName, commandName, conditionType, menuItemsProviderType, shortCut)
        {
        }

        public void ProcessMenuItemName(IModelItem modelItem)
        {
            GuidanceTypeNode guidanceTypeNode = modelItem as GuidanceTypeNode;

            if (guidanceTypeNode != null)
            {
                this.MenuItemName = string.Format(this.MenuItemName, guidanceTypeNode.ModelInstance.DisplayName);
                System.Diagnostics.Debug.WriteLine(this.MenuItemName);
            }
        }
    }
}
